import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    webType: "pc",
    menuList: [],
    hotArticle: [],
    newBook: {},
    // language: "CN",
    language: "EN",
    routePath: "/",
    screenWidth: 1920,
  },
  mutations: {
    CHANG_SCREENWIDTH: (state, val) => {
      state.screenWidth = val;
    },
    setLang(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.language = data;
    },
    setRoutePath(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.routePath = data;
    },
    setWebType(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.webType = data;
    },
    setMenuList(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.menuList = data;
    },
    setHotArticle(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.hotArticle = data;
    },
    setNewBook(state, data) {
      /**
       *testData是state内需要被修改的数据
       *data是传来的数据
       */
      state.newBook = data;
    },
  },
  actions: {},
  modules: {},
});
